Application
.controller('applicationListCtrl',['$rootScope','$scope','getData','currentApp',
	function($rootScope,$scope,getData,currentApp){
	    $rootScope.config = {
	        title :'应用列表'
	    }
	    getData.query({url:'applicationList'},function(data){
	        $scope.applicationList = data;
	    },function(err){
	        console.log(data);
	    });
	    $scope.setAppId = function(id){
	    	currentApp.setCurrentAppId(id);
	    }
	}
])
.controller('applicationMainCtrl',['$rootScope','$scope','currentApp',
	function($rootScope,$scope,currentApp){
		$rootScope.config = {
			title :'应用详情'
		};
		$scope.currentAppId = currentApp.getCurrentAppId();
	}
])
.controller('applicationMaterialCtrl',['$scope','getData',
	function($scope,getData){
		$scope.ajaxList = function(type){
			console.log($scope.currentAppId);
			getData.query({url:'applicationMaterialList',appId:$scope.currentAppId,type:type},function(data) {
	          	$scope.materialList = data;
	        },function(res){
				console.log(res);
			});
		}
		$scope.ajaxPreview = function(id){
			//console.log(applicationMaterialPreview.getPreview(id));
			getData.query({url:'applicationMaterialPreview'},function(data) {
	          	$scope.materialPreview = data[id-1];
	        },function(res){
				console.log(res);
			});
		}
		$scope.ajaxList('mix');
	}
])